home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!news
- From: genew@mindlink.bc.ca (Gene Wirchenko)
- Newsgroups: comp.lang.c
- Subject: Re: void main() and other atrocities!
- Date: Sun, 04 Feb 1996 21:00:56 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4f36ts$j9k@fountain.mindlink.net>
- References: <4eduaj$1aq@grouper.Exis.Net> <4epplj$egf@host-3.cyberhighway.net> <4erjn2INN38b@keats.ugrad.cs.ubc.ca> <9602021300.AA04359@dxmint.cern.ch> <4f2rahINNmud@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: line062.nwm.mindlink.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) wrote:
-
- [snipped previous poster's material]
-
- >I know that it would break a compiler that generates an incompatible linkage
- >for functions returning int and void functions (assuming that the function you
- >are calling does not return). But I just don't know of any that do (and it
- >would be silly to write one that generates subroutine linkage code which breaks
- >when a void function is called that is assumed to be int).
-
- Better not to find out as in gotcha.
-
- >It's also atrocious that main() has to be treated as a special language
- >construct, and that a call to exit() in main() (when it is the last statement)
- >is to be identical to a return.
-
- Why? main() IS a special language construct: it starts the
- program.
-
- >I don't advocate that people declare main() to return void (in fact I don't do
- >so myself), but I don't see it as some sort of big mistake. In my own coding, I
- >sometimes even define the argv/argc parameters even if I don't use them, just
- >to meet the implicity prototype.
-
- I do, too. After all, I may expand the program and need them.
-
- >I did read the relevant section in the FAQ. It is merely concerned with the
- >issue of eliminating compiler warnings stemming from calling exit() in main()
- >despite a "void" declaration thereof. The issue that a void function may
- >not be compatible with a call to an int function doesn't seem that significant,
- >since nobody in their right mind would design a compiler that way.
-
- Why not? After all, no one in their right mind would declare
- void main() <G>.
-
- >In any case, I program using ANSI C only about 30% of the time. The
- >old-fashioned function declarations are more elegant. The only truly useful
-
- "elegant" does not mean more error prone.
-
- >thing introduced in ANSI C is the standardization of variable-length arg list
- >handling. It's the only thing I really miss when working with non-ANSI
- >compilers. The other things I can handle myself: for instance, I don't need the
- >compiler promoting arguments to their prototyped types for me. An explicit cast
- >is more conscientious.
-
- It's also clerk work. I'm a programmer/analyst myself. If the
- language can help me, I'll use the help. If you cast, the promotions
- won't be done.
-
- >There is something magical about the old-style C that attracts me. I can't
- >quite put my finger on it. I was once a very good, careful coder. I wrote neat
- >programs in Modula 2 and similar langauges, always had carefully designed
- >abastract data types. All my cardinal variables belonged to carefully declared
- >and typed domains, arrays had typed ranges, etc. It all went down hill from
- >there!
-
- And now you've found religion? The previous paragraph is
- feelings/opinions only. How did it do down hill?
-
- >Now I'm increasingly catching myself writing assembly code, as though I had
- >gone full-circle. The arguments of what a main() function ought to be sound
- >like the buzzing of flies to me.
-
- Ditto.
-
- >Can someone else identify with me? :)
-
- No, but I can identify you.
-
- >--
-
- Sincerely,
-
- Gene Wirchenko
-
- C Pronunciation Guide:
- y=x++; "wye equals ex plus plus semicolon"
- x=x++; "ex equals ex doublecross semicolon"
-
-